<?php

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
	/**默认路由设置**/
	protected function _initRoutes(){
		$frontController = Zend_Controller_Front::getInstance();
		$router = $frontController->getRouter();
	
		$post = trim($_SERVER['REQUEST_URI'],'/');
		/**列表ROUTE**/
		if(preg_match('/list\/(.*)/i', $post))
		{
			$route = new Zend_Controller_Router_Route_Regex(
					'list/(.*)',
					array(
							'controller'=> 'index',
							'action'=>'list',
					),array('id'=>1));
			$router->addRoute('list',$route);
		}
		
		/**内容ROUTE**/
		if(preg_match('/view\/(.*)/i', $post))
		{
			$route = new Zend_Controller_Router_Route_Regex(
					'view/(.*)',
					array(
							'controller'=> 'index',
							'action'=>'view',
					),array('id'=>1));
			$router->addRoute('view',$route);
		}
		
		/**
		 * 评论route
		 */
		if(preg_match('/comment\/(.*)/i', $post))
		{
			$route = new Zend_Controller_Router_Route_Regex(
					'comment/(.*)',
					array(
							'controller'=> 'index',
							'action'=>'comment',
					),array('id'=>1));
			$router->addRoute('view',$route);
		}
	}
}

